import json

import matplotlib.pyplot as plt


path = r'D:\Project\multimoding\project\public-analysis\res\4090_res\data\train_loss.json'

with open(path, 'r', encoding='utf-8') as fp:
    data = json.load(fp)

epoch = range(0, len(data))
data = [loss[2] for loss in data]

plt.figure(figsize=(10, 10))
plt.plot(epoch, data, marker='o')

for epoch, loss in enumerate(data, start=1):
    plt.text(epoch, loss, f'{loss:.2f}', fontsize=10)

plt.title('train loss per Epoch')
plt.xlabel('Epoch')
plt.ylabel('Value')
plt.legend()
plt.grid(True)

plt.savefig(r'D:\Project\multimoding\project\public-analysis\res\4090_res\png\train_loss.png')


